home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 41.zip / BS1 part 41 / Abacus diskdrives IO.adf / CH9 / write.s < prev    next >
Text File  |  1978-06-28  |  4KB  |  15 lines

  1. Device         = 350Port           = 36         ;Offset for Drive 0RepPort        = 174SigTask        = 16Task           = 276FindName       = -276Track          = 20         ;Number of the Tracks to be read Address        = $50000     ;The Address from which storage
  2. ; starts can only be in Chip-Memory. Here $50000 was selected.
  3.                move.l $4,a6          ;get ExecBase                lea Name,a1           ;set Pointer to Name                lea Device(a6),a0     ;Pointer to Device-List               jsr FindName(a6)      ;search for Trackdisk-Device                tst.l d0              ;Device found ?               beq Error             ;No, Error               move.l Task(a6),a0    ;get Pointer to user Task               move.l d0,a6          ;Pointer to Task to A6               move.l Port(a6),a3    ;get Pointer to Drive-                                     ;Port (Drive 0)               lea RepPort(a3),a1       ;Pointer to RepPort               move.l SigTask(a1),-(a7) ;save Pointer to Task               move.l a1,-(a7)          ;save Pointer to RepPort               move.l a0,SigTask(a1)    ;store user Task                bset #0,34(a3)           ;block Trackdisk-Task ; Starting here is the actual write routine               move.l #1,d0         ;Value for Motor on                jsr $FEA462          ;switch Motor on                move.l #TRACK,D2     ;Track-Number to D2               move.l D2,D0         ;Track-Number to D0               jsr $FEA3DA          ;Head positioning                lea Address,A5       ;Pointer to Start address of Data to                                    ;transmit to A5
  4.                move.l $52(A3),A2    ;Pointer to Write buffer
  5.                lea 4(A2),A2               move.w #$FFF,D0      ;erase counter value                move.l #$AAAAAAAA,D1 ;Value for erasing L1:            move.l D1,(A2)+      ;erase Write buffer                dbra D0,L1           ;branch, until done                movea.l  $52(A3),A2  ;Pointer to Write buffer
  6.                lea $680(A2),A2      ;Pointer to beginning of data
  7.                moveq #$0B,D4        ;Number of Blocks                moveq #0,D5          ;Block counter to NullL2:            move.l #$FF000000,D0 ;DOS identification of the Header               move.l D5,D1         ;Block number to D1               lsl.l #8,D1          ;shift Number to proper                                     ;position                or.l D1,D0           ;store in Header                or.l D4,D0           ;store number of blocks to gap               move.l D2,D1         ;Track-Number to D1               swap D1              ;Number to proper Position               or.l D1,D0           ;enter Track-Number                movea.l A2,A1        ;Write buffer to A1               movea.l A5,A0        ;Pointer to Data to A0
  8.                jsr $FEAADC          ;code Data and shift into
  9.                                     ;Write buffer
  10.                addq.l #1,D5         ;increment Block counter                adda.l #$440,A2      ;Pointer to next Block                                        ;in the Write buffer
  11.                adda.l #$200,A5      ;Pointer to next Data                subq.l #1,D4         ;decrement number of Blocks
  12.                bne.s L2             ;branch, if not finished coding                movea.l $52(A3),A0   ;Pointer to Write buffer
  13.                lea 4(A0),A0               move.w #$353E,D0     ;Data number for writing                jsr $FEA5B4          ;write Track                move.l #0,d0         ;Value for Motor off                jsr $FEA462          ;switch Motor off ; End of the write routine. The changed ; Pointers must be restored.Ende:          bclr #0,34(a3)           ;release Task again
  14.                move.l (a7)+,a1          ;get Pointer to Task                move.l (a7)+,SigTask(a1) ;store in Port againError:         rts                       ;Return jump
  15. Name:          dc.b 'trackdisk.device',0               END